<ion-content>
  <div class="cover-header">
    <h1>订单管理</h1>
    <p>一站式管理订单</p>
  </div>
  <div class="sub-info">{{title}}</div>
  <ion-row>
    <ion-col col-8>
      <ion-input type="text" name="searchParam" [(ngModel)]="searchParam" placeholder="请输入查找内容" ></ion-input>
    </ion-col>
    <ion-col col-4>
      <ion-select placeholder="状态" [(ngModel)]="orderStatus" name="businessFilter">
      <ion-option value="0">
        未接单
      </ion-option>
      <ion-option value="1">
        已接单
      </ion-option>
      <ion-option value="2">
        已完成
      </ion-option>
    </ion-select>
    </ion-col>
  </ion-row>
  <ion-card *ngIf="filter().length<=0">
    <ion-card-content>
      <ion-card-title>
        暂无订单
      </ion-card-title>
    </ion-card-content>
  </ion-card>
  <ion-card *ngFor="let item of filter(); let i = index">
    <ion-card-content>
      <img *ngIf="item.photos&&item.photos.length>0" src="{{item.photos[0]}}" />
      <ion-card-title>
        {{item.typeName}}
      </ion-card-title>
      <ion-row>
        <ion-col>
          <p>
           发布者:{{item.publisher}}
          </p>
        </ion-col>
        <ion-col>
          <p *ngIf="item.recipient">
           接单者:{{item.recipient}}
          </p>
        </ion-col>
      </ion-row>
      <ion-row>
        <ion-col>
          <p>
            单价:{{item.price}} 
          </p>
        </ion-col>
        <ion-col>
          <p>
            数量:{{item.number}}
          </p>
        </ion-col>
      </ion-row>
      <ion-row>
        <ion-col>
          <p> 订单号:{{item.code}} </p>
        </ion-col>
      </ion-row>
    </ion-card-content>
    <ion-row>
      <ion-col *ngIf="item.recipient_id||item.status==1">
      </ion-col>
      <ion-col>
        <button *ngIf="currentUser.factory.type==0" ion-button icon-left clear small (click)="toCommentOrder(item)">
          <div>评价</div>
        </button>
      </ion-col>
      <ion-col>
        <button ion-button icon-left clear small (click)="toDetailOrder(item)">
          <div>订单详情</div>
        </button>
      </ion-col>
      <ion-col *ngIf="(!item.recipient_id||item.recipient_id==currentUser.user.id)&&item.status !=1">
        <button ion-button icon-left clear small (click)="modifyOrder(item)">
          <div>{{currentUser.factory.type==0?'修改订单':'完成订单'}}</div>
        </button>
      </ion-col>
    </ion-row>
  </ion-card>
  <button ion-button full (click)="toPublicOrder()">{{btnText}}</button>
</ion-content>

